package com.lfd.rabbitmq.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @项目名： spring-emq
 * @包名： com.lfd.rabbitmq.config
 * @文件名: RabbitConfig
 * @创建者: liufudong@szyh-smart.com
 * @创建时间: 2024/9/30 15:26
 * @描述：3. RabbitMQ配置类  创建一个RabbitMQ配置类，定义交换机、队列和绑定关系。
 */
@Configuration
@Slf4j
public class RabbitConfig {
    public static final String EXCHANGE_NAME = "demo.exchange";
    public static final String QUEUE_NAME = "demo.queue";
    public static final String ROUTING_KEY = "demo.routing.key";

//    @Bean
//    public TopicExchange exchange() {
//        return new TopicExchange(EXCHANGE_NAME, true, false);
//    }
//
//    @Bean
//    public Queue queue() {
//        return new Queue(QUEUE_NAME, true);
//    }
//
//    @Bean
//    public Binding binding(TopicExchange exchange, Queue queue) {
//        return BindingBuilder.bind(queue).to(exchange).with(ROUTING_KEY);
//    }
}
